import Vue from 'vue'
import Vuex from 'vuex'
import '../../utils/vue-extend'
import App from './App.vue'
import Router from 'vue-router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import FormBuilder from '../../components/form/FormBuilder.vue'
import FormPreview from '../../components/form/FormPreview.vue'
import FormManager from '../../components/form/FormManager.vue'

Vue.config.productionTip = false

const routes = [
    {path: '/form-builder', component: FormBuilder, name: 'form-builder'},
    {path: '/form-preview', component: FormPreview, name: 'form-preview'},
    {path: '/form-manager', component: FormManager, name: 'form-manager'}
]

// 3. 创建 router 实例，然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new Router({
    routes: routes
})
Vue.use(Router);
Vue.use(ElementUI);
Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        formJsonData: {},
        editModelId: ''
    },
    mutations: {
        updateFormJsonData (state,data) {
            state.formJsonData = data
        },
        setEditModelId(state,modelId){
            state.editModelId = modelId;
        }
    }
})

new Vue({
    render: h => h(App),
    router,
    store
}).$mount('#app')
